with open('input.txt') as file:
    trees = [line.strip() for line in file.readlines()]
    width = len(trees[0])

    x, y = 0, 0
    count = 0

    for (y, line) in enumerate(trees):
        x = (3 * y) % width
        if line[x] == '#':
            count += 1

    print(count)